﻿(function () {
    NSFile("Gianduia.AppKit.NSComponent");
    NSImport("Gianduia.AppKit.NSResponder", "Gianduia.Foundation.NSDOMNode", "Gianduia.Foundation.NSNotificationCenter", "Gianduia.Foundation.NSHTTPRequest", "Gianduia.Foundation.NSDictionary", "Gianduia.AppKit.NSBindingDeclaration", "Gianduia.Foundation.NSKeyValueObserving", "Gianduia.Foundation.NSKeyValueBinding", "Gianduia.AppKit.NSWindow");
    NSClass("Gianduia.AppKit.NSComponent").Extends("Gianduia.AppKit.NSResponder").Implements({
        "+load": function () {
            var B = this.prototype, A;
            this._templateLoadingState = -1;
            this._templateDeclarationsLoadingState = -1;
            this._isTemplateHTMLLoaded = false;
            this._isTemplateImportsLoaded = false;
            B._ownedComponentsIds = [];
            if (this === Gianduia.AppKit.NSComponent) {
                B._templateInsertionMode = this.prototype.NSTemplateInsertionModeReplace;
                B.superBindToObjectWithKeyPathOptions = B.superMethodNamed("bindToObjectWithKeyPathOptions");
                B._componentsNeedingDisplay = [];
                B._componentsNeedingPrepareForDisplay = [];
                B._defaultWillDraw = B.willDraw;
                B._defaultDraw = B.draw;
                B._defaultDidDraw = B.didDraw;
                B._defaultAwakeFromNoc = B.awakeFromNoc;
                window.defaultCenter.addObserver(Gianduia.AppKit.NSComponent, "rootComponentDocumentLoaded", "load", Gianduia)
            }
        }, window: function () {
            return window
        }, notificationCenter: Gianduia.Foundation.NSNotificationCenter.defaultCenter, useSharedInstance: function () {
            return false
        }, sharedInstance: function () {
            if (!this.prototype.useSharedInstance()) {
                return null
            } if (this._sharedInstance === undefined) {
                this._sharedInstance = (new this).init()
            } else {
                var A = this._sharedInstance;
                A.setIsTemplateInserted(false)
            } return this._sharedInstance
        }, componentWithOwnerComponentDeclarationParentComponent: function (D, H, F, B, C, G, A) {
            var E = H.typeClass();
            if (typeofE !== "function") {
                Gianduia.Foundation.NSException.raiseExceptionWithNameReasonUserInfo("NSComponentClassMissingException", "NSComponent class" + H._type + " is missing within " + this.className(), {
                    declarationType: type
                })
            } return (E.prototype.sharedInstance.call(E) || (new E)).initWithOwnerComponentDeclarationParentComponent(D, H, F, B, C, G, A)
        }, initWithOwnerComponentDeclarationParentComponent: function (C, B, D, F, E, G, H) {
            var J = this.hasTemplate(), A = [this.className()];
            this._ownerComponentDeclaration = B;
            if (B != null) {
                A.push(B._name);
                if (B._elementClasses != null) {
                    A.push.apply(A, B._elementClasses.allObjects())
                }
            } else {
                var I = E.className ? E.className : E.getAttribute("class");
                if (I && I.length > 0) {
                    A.push.apply(A, I.split(" "))
                }
            } this.setElementClasses(Gianduia.Foundation.NSStringSet.setWithObjects(A));
            this._elementAttributesBuffer = [];
            if (H === undefined) {
                H = true
            } this._elementId = ((F) ? F + "." : (B ? B.cssQualifiedName() + "." : "")) + this.nsId();
            if (!E && !this._isRootComponent) {
                throwthis.toString() + ": initWithOwnerComponentDeclarationParentComponent NO ELEMENT"
            } this.setElement(E);
            this.setOwnerComponent(C);
            if (D) {
                D._setChildComponent(this, true)
            } if (H) {
                this.connectBindingsIfNeeded()
            } if (!this._hidden) {
                this._needsDisplay = true
            } if (D) {
                D.addChildComponent(this)
            } if (!J || (J && this.constructor._templateLoadingState === 1)) {
                this.initializeChildComponents()
            } this._didInit = true;
            if (!this._hidden) {
                this.setNeedsDisplay(true)
            } return this
        }, acceptsEvents: NSProperty({
            defaultValue: true
        }), ownerComponentDeclaration: NSProperty(), setElement: function (A) {
            if (A != this._element) {
                if (this._element && this._acceptsEvents) {
                    window._nsWindow.unregisterResponderForElement(this, this._element)
                } this._element = A;
                if (A) {
                    if (this._acceptsEvents) {
                        window._nsWindow.registerResponderForElement(this, A)
                    } if (A.nodeType === 1) {
                        if (this._elementId && A.id !== this._elementId) {
                            A.id = this._elementId
                        } if (this._ownerComponentDeclaration && this._ownerComponentDeclaration._elementClasses) {
                            this.addElementClasses(this._ownerComponentDeclaration._elementClasses)
                        } if (this._elementTabindex != null && this._elementTabindex !== 0) {
                            this.setElementTabindex(A.tabindex)
                        }
                    }
                }
            }
        }, _elementId: null, setElementId: function (A) {
            if (this._element) {
                this._element.id = A
            } this._elementId = A
        }, elementId: function () {
            return this._elementId
        }, _element: null, element: function () {
            return this._element
        }, setElementValueForKey: function (B, A) {
            this._elementAttributesBuffer[(this._elementAttributesBuffer[this._elementAttributesBuffer.length] = A)] = B;
            this.setNeedsDisplay(true)
        }, elementValueForKey: function (A) {
            return (this._elementAttributesBuffer.length > 0 && (!this._elementAttributesBuffer[A] || !this._elementAttributesBuffer.hasOwnProperty(A))) ? this._element.getAttribute(A) : this._elementAttributesBuffer[A]
        }, templateInsertionMode: NSProperty(), _elementClass: null, setElementClass: function (A) {
            if (this._elementClass && this._elementClass.length > 0) {
                this.removeElementClasses(this._elementClass)
            } if (A) {
                this._elementClass = A.split(" ");
                this.addElementClasses(this._elementClass)
            } return
        }, elementClass: function () {
            return this._elementClasses.allObjects().componentsJoinedByString(" ")
        }, simpleElementClasses: function () {
            return this._elementClasses
        }, _needsElementClassUpdate: false, _elementClasses: null, elementClasses: function () {
            if (!this._elementClasses) {
                this.elementClasses = this.simpleElementClasses;
                this.setElementClasses(Gianduia.Foundation.NSStringSet.set())
            } this.observeElementClassesIfNeeded();
            return this._elementClasses
        }, addElementClasses: function (A) {
            if (this._elementClasses.addObjectsFromArray((arguments.length > 1) ? arguments : ((typeofA === "string") ? A.split(" ") : A), true)) {
                this._needsElementClassUpdate = true;
                this.setNeedsDisplay(true)
            }
        }, removeElementClasses: function (A) {
            this._elementClasses.removeObjectsFromArray((arguments.length > 1) ? arguments : ((typeofA === "string") ? A.split(" ") : A));
            this._needsElementClassUpdate = true;
            this.setNeedsDisplay(true)
        }, setElementClasses: function (A) {
            if (A !== this._elementClasses) {
                if (this._elementClasses && this._doesObserveElementClasses) {
                    this._elementClasses.removeObserverForKeyPath(this, "content")
                } this._elementClasses = A;
                if (A && this._doesObserveElementClasses) {
                    A.addObserverForKeyPathComponentsOptionsContext(this, ["content"], null, null, "elementClassesDidChange")
                } this._needsElementClassUpdate = true;
                this.setNeedsDisplay(true)
            }
        }, elementClassesDidChange: function () {
            this._needsElementClassUpdate = true;
            this.setNeedsDisplay(true)
        }, elementTabindex: NSProperty({
            setterImplementation: function (A) {
                this._elementTabindex = A;
                this.setElementValueForKey(A, "tabindex")
            }, defaultValue: 0
        }), _doesObserveElementClasses: false, observeElementClassesIfNeeded: function () {
            if (!this._doesObserveElementClasses) {
                this._doesObserveElementClasses = true;
                this._elementClasses.addObserverForKeyPathComponentsOptionsContext(this, ["content"], null, null, "elementClassesDidChange")
            }
        }, _replaceElementWithElement: function (F, C) {
            var D, G = 0, E, B, A;
            if (C.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                if (!C.firstChild) {
                    return F
                } if (C.childNodes.length === 1) {
                    F.parentNode.replaceChild(C, F)
                } else {
                    B = F;
                    G = 0;
                    A = F.parentNode;
                    while ((B = B.previousSibling)) {
                        G++
                    } if (F.parentNode === A) {
                        A.removeChild(F)
                    } A.insertBefore(C, A.childNodes[G])
                }
            } else {
                D = F.attributes;
                while ((E = D[G++])) {
                    if (!E.specified || E.expando) {
                        continue
                    } if (E.name === "class") {
                        if (C.nodeType === Node.ELEMENT_NODE && E.value) {
                            this.addElementClasses(E.value)
                        }
                    } C.setAttribute(E.name, E.value)
                } F.parentNode.replaceChild(C, F)
            } return C
        }, innerTemplate: function () {
            return this._ownerComponentDeclaration.innerTemplate()
        }, setInnerTemplate: function (A) {
            this._ownerComponentDeclaration.setInnerTemplate(A)
        }, NSTemplateInsertionModeIgnore: 1, NSTemplateInsertionModeReplace: 2, NSTemplateInsertionModeUpdate: 4, NSTemplateInsertionModeInsert: 8, NSTemplateInsertionModeInsertAppend: 16, NSTemplateInsertionModeInsertBefore: 32, NSTemplateInsertionModeInsertAfter: 64, insertTemplate: function () {
            if (this._isRootComponent) {
                return
            } var A = this._element, C, B;
            if (!this._ownerComponentDeclaration._innerTemplate && this.hasTemplate() && A.firstChild) {
                this._ownerComponentDeclaration.setInnerTemplate(A.extractedInnerDocumentFragment())
            } if (((C = this.templateInsertionMode()) !== this.NSTemplateInsertionModeIgnore) && (B = this.template())) {
                if (C === this.NSTemplateInsertionModeInsertAppend) {
                    A.appendChild(B)
                } else {
                    if (C === this.NSTemplateInsertionModeReplace) {
                        this.setElement(this._replaceElementWithElement(this._element, B))
                    } else {
                        if (C === this.NSTemplateInsertionModeInsert) {
                            if (A.firstChild) {
                                A.removeAllChildNodes();
                                A.appendChild(B)
                            } else {
                                A.appendChild(B)
                            }
                        } else {
                            if (C === this.NSTemplateInsertionModeInsertBefore) {
                                A.parentNode.insertBefore(B, A)
                            } else {
                                if (C === this.NSTemplateInsertionModeInsertAfter) {
                                    A.parentNode.insertBefore(B, A.nextSibling)
                                }
                            }
                        }
                    }
                } this._isTemplateInserted = true
            } A = null
        }, isReadOnlyBinding: function (A) {
            return false
        }, connectBindingsIfNeeded: function () {
            if (!this._ownerComponentDeclaration) {
                return
            } var B, A = 0;
            iBinding = null;
            if (B = this._ownerComponentDeclaration.bindings()) {
                while ((iBinding = B[A++])) {
                    iBinding.establishBindingFromObjectToObjectWithOptions(this, null, null)
                }
            } B = null
        }, isTemplateInserted: NSProperty({
            defaultValue: false
        }), addOwnedComponent: function (A) {
        }, removeOwnedComponent: function (A) {
        }, ownerComponentTemplateChildComponents: NSProperty(), areChildComponentInitialized: function () {
            return this._areChildComponentInitialized
        }, _initializeChildComponentsForEach: function (B, C) {
            var A = C.objectForKey(B);
            this.componentWithOwnerComponentDeclarationParentComponent(this, A, this, A.cssQualifiedName(), this.elementForChildDeclaration(A), true)
        }, elementForChildDeclaration: function (A) {
            return A.nodeAccessFunction(this._element)
        }, initializeChildComponents: function (B) {
            var K = this.hasTemplate(), C = null, E = null, G, H, A, D = 0, F, J, I, L;
            this._isInitializingChildComponents = true;
            if ((!K || (K && this.ownerComponentTemplateChildComponents() === null)) && (G = this._ownerComponentDeclaration)) {
                A = this._ownerComponent;
                if ((H = G.childDeclarations()) !== null) {
                    while ((F = H[D++])) {
                        this.componentWithOwnerComponentDeclarationParentComponent(A, F, this, F.cssQualifiedName(), this.elementForChildDeclaration(F), true)
                    }
                }
            } if (K && !this._isTemplateInserted) {
                this.insertTemplate()
            } if (K) {
                J = this._childComponents;
                if (J && (J.length > 0)) {
                    this.setOwnerComponentTemplateChildComponents(J);
                    this.setChildComponents(undefined)
                } if (this.constructor._templateLoadingState === 1) {
                    I = this.hierarchicalMapping();
                    if (I) {
                        I.forEach(this._initializeChildComponentsForEach, this, I)
                    }
                }
            } this.performChildComponentAwakeFromNoc();
            this._isInitializingChildComponents = false;
            this._areChildComponentInitialized = true;
            this.didInitializeChildComponents();
            if (this._childComponents && this._childComponents.length > 0) {
                this.setNeedsDisplay(true)
            }
        }, didInitializeChildComponents: function () {
        }, performChildComponentAwakeFromNoc: function () {
            var A, C, B;
            if (A = this._childComponents) {
                C = this._defaultAwakeFromNoc;
                B = 0;
                while ((iChildComponent = A[B++])) {
                    if (iChildComponent.awakeFromNoc !== C) {
                        iChildComponent.awakeFromNoc()
                    }
                }
            }
        }, _isInitializingChildComponents: false, isInitializingChildComponents: function () {
            return this._isInitializingChildComponents
        }, awakeFromNoc: function () {
        }, _areChildComponentInitialized: false, childComponents: function () {
            if (!this._childComponents) {
                this._childComponents = []
            } return this._childComponents
        }, _setChildComponent: function (B, A) {
            B.setNextResponder(A ? this : null);
            B.setParentComponent(A ? this : null)
        }, _childComponents: undefined, addChildComponent: function (C, B) {
            if (!C) {
                return
            } var A = this.childComponents();
            if (C._parentComponent !== this) {
                this._setChildComponent(C, true)
            } if (typeofB === "number") {
                A.insertObjectAtIndex(C, B)
            } else {
                A[A.length] = C
            }
        }, replaceChildComponentWithComponent: function (B, C) {
            var A = this._childComponents.indexOf(B);
            this._setChildComponent(B, false);
            this._setChildComponent(C, true);
            this._childComponents[A] = C;
            if (C._element && B._element) {
                this._replaceElementWithElement(B._element, C._element)
            }
        }, removeChildComponent: function (B, A) {
            if (typeof (A) !== "number") {
                A = this._childComponents.indexOf(B._nsId)
            } this._childComponents.splice(B, 1);
            B.setNextResponder(null);
            B.setParentComponent(null);
            this._childComponentCanDrawFieldDefinition.removeFlag(B._nsId);
            delete B
        }, removeChildComponents: function (C) {
            if (!this._childComponents || !C) {
                return
            } var B = 0, A = null;
            while ((A = C[B++])) {
                this.removeChildComponent(A)
            }
        }, setChildComponents: function (C) {
            var B = 0, A;
            if (C && (A = C.length) > 0) {
                for (; B < A; B++) {
                    this.addChildComponent(C[B])
                }
            } else {
                this._childComponents = C
            }
        }, parentComponent: NSProperty(), templateDidLoad: function (A) {
            window.defaultCenter.removeObserver(this, "templateDidLoad", "templateLoad", this.constructor);
            this.initializeChildComponents();
            this.setNeedsDisplay(true)
        }, _isPreparingForDisplay: false, childComponentNeedsPrepareForDisplay: function (A) {
            if (!this._childComponentNeedsPrepareForDisplayBitField) {
                this._childComponentNeedsPrepareForDisplayFieldDefinition = new NSBitFieldDefinition();
                this._childComponentNeedsPrepareForDisplayBitField = new NSBitField(this._childComponentNeedsPrepareForDisplayFieldDefinition);
                this._childComponentNeedsPrepareForDisplayBitField.setDelegate(this, "allChildComponentsCanDisplay")
            } this._childComponentNeedsPrepareForDisplayFieldDefinition.addFlag(A._nsId)
        }, childComponentIsPreparedForDisplay: function (A) {
            if (this._childComponentNeedsPrepareForDisplayBitField) {
                this._childComponentNeedsPrepareForDisplayBitField.setValueForKey(true, A._nsId)
            } else {
                if (!this._isInitializingChildComponents) {
                    this.setNeedsDisplay(true)
                }
            }
        }, allChildComponentsCanDisplay: function (A) {
            this.registerForDisplay()
        }, _needsPrepareForDisplay: false, needsPrepareForDisplay: function () {
            return this._needsPrepareForDisplay
        }, setNeedsPrepareForDisplay: function (A) {
            if (A !== this._needsPrepareForDisplay) {
                if (A) {
                    if (this._parentComponent) {
                        this._parentComponent.childComponentNeedsPrepareForDisplay(this)
                    } this._componentsNeedingPrepareForDisplay[this._componentsNeedingPrepareForDisplay.length] = this;
                    if (!Gianduia.AppKit.NSComponent._componentsWillDisplayTimeout) {
                        Gianduia.AppKit.NSComponent._componentsWillDisplayTimeout = this.performSelectorAfterDelay("processComponentsNeedingPrepareForDisplay", 0)
                    } this._isPreparingForDisplay = true;
                    this._isInDrawList = false
                } this._needsPrepareForDisplay = A
            }
        }, processComponentsNeedingPrepareForDisplay: function () {
            var B = 0, A, C = this._componentsNeedingPrepareForDisplay;
            while ((A = C[B++])) {
                A.prepareForDisplay()
            } C.splice(0, C.length);
            Gianduia.AppKit.NSComponent._componentsWillDisplayTimeout = null
        }, prepareForDisplay: function () {
            if (this._needsPrepareForDisplay) {
                this._needsDisplay = true;
                if (this.hasTemplate() && this.constructor._templateLoadingState !== 1) {
                    window.defaultCenter.addObserver(this, "templateDidLoad", "templateLoad", this.constructor);
                    if ((this.constructor._templateLoadingState !== 0)) {
                        this.loadTemplate()
                    }
                } else {
                    if (!this._areChildComponentInitialized) {
                        this.initializeChildComponents()
                    }
                }
            }
        }, _isPreparedForDisplay: true, isPreparedForDisplay: function () {
            if (!this._areChildComponentInitialized) {
                return false
            } if (this.hasTemplate() && this.constructor._templateLoadingState !== 1) {
                return false
            } if (this._childComponentNeedsPrepareForDisplayBitField) {
                if (!this._childComponentNeedsPrepareForDisplayBitField.isTrue()) {
                    return false
                }
            } return this._isPreparedForDisplay
        }, registerForDisplay: function () {
            if (!this._isInDrawList) {
                var A = this._parentComponent ? this._parentComponent.needsDisplay() : false;
                if (this._parentComponent && A) {
                    this._parentComponent.childComponentIsPreparedForDisplay(this)
                } else {
                    if (!this._parentComponent || (this._parentComponent && !A)) {
                        this._componentsNeedingDisplay[this._componentsNeedingDisplay.length] = this;
                        if (!Gianduia.AppKit.NSComponent._componentNeedsDisplayTimeout) {
                            Gianduia.AppKit.NSComponent._componentNeedsDisplayTimeout = this.performSelectorAfterDelay("processComponentsNeedingDisplay", 0)
                        }
                    }
                } this._isInDrawList = true
            }
        }, processComponentsNeedingDisplay: function () {
            var C = Gianduia.AppKit.NSComponent.prototype, B = this._componentsNeedingDisplay, A = 0;
            C._isDrawing = true;
            A = 0;
            do {
                B[A++].displayIfNeeded()
            } while (A < B.length);
            C._isDrawing = false;
            C._componentsNeedingDisplay = [];
            Gianduia.AppKit.NSComponent._componentNeedsDisplayTimeout = null
        }, _componentNeedsDisplayTimeout: null, _isDisplaying: false, _isInDrawList: false, _needsDisplay: false, needsDisplay: function () {
            return this._needsDisplay || (this._needsDisplayCount > 0)
        }, _needsDisplayCount: 0, _recursiveSetNeedsDisplay: function (A) {
            this.setNeedsDisplay(A);
            if (this._childComponents) {
                this._childComponents.makeObjectsPerformSelectorWithObjects("_recursiveSetNeedsDisplay", A)
            }
        }, setNeedsDisplay: function (A) {
            if (A === undefined) {
                A = true
            } if (!this._didInit) {
                return
            } if (A !== this._needsDisplay || this._isDrawing) {
                this._needsDisplay = A;
                (this._isDrawing) ? ((A) ? this._needsDisplayCount++ : this._needsDisplayCount--) : ((this._needsDisplayCount = A) ? 1 : 0)
            } if (A) {
                this.isPreparedForDisplay() ? this.registerForDisplay() : this.setNeedsPrepareForDisplay(true)
            } else {
                if (!this._isDrawing) {
                    this._componentsNeedingDisplay.slice(this._componentsNeedingDisplay.indexOf(this), 1);
                    this._isInDrawList = false
                }
            }
        }, displayIfNeeded: function () {
            if (this.canDraw()) {
                this.displayElement()
            } else {
                this._isInDrawList = false
            }
        }, displayElement: function () {
            this._willDraw();
            this._draw();
            this._didDraw()
        }, display: function () {
            this._recursiveSetNeedsDisplay(true)
        }, cssClassForKey: function (A) {
            var B = "cssClassFor" + A.capitalizedString();
            if (typeofthis[B] === "function") {
                return this[B]()
            } else {
                return A
            }
        }, cssClassForHidden: function () {
            return "NSCSSStateHidden"
        }, _wasHidden: false, hidden: NSProperty({
            defaultValue: false, setterImplementation: function (A) {
                if (!!A !== this._hidden) {
                    this._wasHidden = this._hidden;
                    (this._hidden = !!A) ? this.addElementClasses(this.cssClassForHidden()) : this.removeElementClasses(this.cssClassForHidden());
                    if (this._wasHidden) {
                        this.setNeedsDisplay(true)
                    } else {
                        this._element.className = this._elementClasses.allObjects().join(" ");
                        this._needsElementClassUpdate = false
                    }
                }
            }, getter: "isHidden"
        }), _canDraw: false, _canDrawTrue: function () {
            return true
        }, canDraw: function () {
            if (this._hidden || !this._element || !this._areChildComponentInitialized) {
                return false
            } if (this.hasTemplate() && this.constructor._templateLoadingState !== 1) {
                return false
            } return true
        }, _willDraw: function () {
            if (this._delegate && this._delegate.respondsToSelector("componentWillDraw")) {
                this._delegate.componentWillDraw(this)
            } if (this.willDraw !== this._defaultWillDraw) {
                this.willDraw()
            } var C = 0, B = this._childComponents, A;
            if (B && B.length > 0) {
                do {
                    if ((A = B[C++])._needsDisplay) {
                        A._willDraw()
                    }
                } while (C < B.length)
            }
        }, willDraw: function () {
        }, innerText: NSProperty({
            defaultValue: null, setterImplementation: function (A) {
                if (A !== this._innerText) {
                    this._innerText = A;
                    this.setNeedsDisplay(true)
                }
            }
        }), innerHTML: NSProperty({
            defaultValue: null, setterImplementation: function (A) {
                if (A !== this._innerHTML) {
                    this._innerHTML = A;
                    this.setNeedsDisplay(true)
                }
            }
        }), setAttributesFromBuffer: function (B, A) {
            if (i = A.length) {
                do {
                    B.setAttribute(A[--i], A[A[i]])
                } while (i);
                this._elementAttributesBuffer = []
            }
        }, _draw: function () {
            var B = this._elementAttributesBuffer, D = this._element, F = 0, E = this._childComponents, C, A;
            this.setAttributesFromBuffer(D, B);
            if (this._innerText != null) {
                if (!this._innerTextNode) {
                    if (D.firstChild && D.childNodes.length === 1 && D.firstChild.nodeType === Node.TEXT_NODE) {
                        (this._innerTextNode = D.firstChild).nodeValue = this._innerText
                    } else {
                        D.removeAllChildNodes();
                        D.appendChild((this._innerTextNode = document.createTextNode(this._innerText)))
                    }
                } else {
                    this._innerTextNode.nodeValue = this._innerText
                }
            } else {
                if (this._innerHTML != null) {
                    this._element.innerHTML = this._innerHTML
                }
            } if (this._needsElementClassUpdate) {
                this._element.className = this._elementClasses.allObjects().join(" ");
                this._needsElementClassUpdate = false
            } if (this.draw !== this._defaultDraw) {
                this.draw()
            } F = 0;
            if ((E = this._childComponents) && (C = E.length) > 0) {
                do {
                    if ((A = E[F++])._needsDisplay) {
                        A._draw()
                    }
                } while (F < C)
            }
        }, draw: function () {
        }, _didDraw: function () {
            var C = 0, B = this._childComponents, A;
            if (B && B.length > 0) {
                do {
                    if ((A = B[C++])._needsDisplay) {
                        A._didDraw()
                    }
                } while (C < B.length)
            } if (this.didDraw !== this._defaultDidDraw) {
                this.didDraw()
            } if (this._delegate && this._delegate.respondsToSelector("componentDidDraw")) {
                this._delegate.componentDidDraw(this)
            } this._isPreparingForDisplay = false;
            this.setNeedsDisplay(false);
            this._isInDrawList = false;
            if (this._firstDraw && this._isRootComponent) {
                this._firstDraw = false;
                window.defaultCenter.postNotificationName("didFirstDraw", this)
            }
        }, didDraw: function () {
        }, firstDraw: NSProperty({
            defaultValue: true
        }), "static sharedInstanceForClassName": function (B) {
            var C = null, A;
            if (!Gianduia.AppKit.NSComponent._sharedInstanceByClassName) {
                Gianduia.AppKit.NSComponent._sharedInstanceByClassName = {
            }
        } A = Gianduia.AppKit.NSComponent._sharedInstanceByClassName[B];
        if (!A) {
            A = [];
            window.NSEval("sharedInstance = new " + B + "().init()");
            A[A.length] = C;
            Gianduia.AppKit.NSComponent._sharedInstanceByClassName[B] = A
        } if (A.length > 0) {
            C = A.pop()
        } else {
            window.NSEval("sharedInstance = new " + B + "().init()")
        } return C
    }, "static checkInComponentInstance": function (A) {
        Gianduia.AppKit.NSComponent._sharedInstanceByClassName[A.className()].push(A)
    }, _isRootComponent: false, isRootComponent: function () {
        return this._isRootComponent
    }, setTemplateDocumentFragment: function (A) {
        if (this._templateURL) {
            this._template = A
        } else {
            this.constructor._template = A
        }
    }, template: function () {
        return this._template || this.constructor._template.cloneNode(true)
    }, _hasTemplate: true, __hasTemplate: function () {
        return this._hasTemplate
    }, hasTemplate: function () {
        return this._hasTemplate
    }, setHasTemplate: function (A) {
        this._hasTemplate = A
    }, "+hasTemplate": NSProperty({
        defaultValue: true
    }), "+hasChildComponents": NSProperty({
        defaultValue: true
    }), hasChildComponents: function () {
        return this.constructor.hasChildComponents()
    }, "+templateWrapperURL": function () {
        return this._package().url() + "/" + this.className() + ".noc"
    }, _templateURL: null, setTemplateURL: function (A) {
        if (A != this.templateURL()) {
            if (this._templateURL = A) {
                this._hasTemplate = true;
                this.setNeedsDisplay(true)
            }
        }
    }, templateURL: function () {
        return this._templateURL || this.constructor.templateURL()
    }, "+templateURL": function () {
        return this._templateURL || (this.templateWrapperURL() + "/" + this.className() + ".html")
    }, setIsTemplateImportsLoaded: function (A) {
        if (this.constructor._isTemplateImportsLoaded = A) {
            if (this.isTemplateHTMLLoaded() && this.isTemplateDeclarationsLoaded()) {
                this.setIsTemplateLoaded(true)
            }
        }
    }, isTemplateImportsLoaded: function () {
        return this.constructor._isTemplateImportsLoaded
    }, _declarationTypesToLoad: null, declarationTypesToLoad: function () {
        if (this._declarationTypesToLoad === null) {
            this._declarationTypesToLoad = Gianduia.Foundation.NSSet.set()
        } return this._declarationTypesToLoad
    }, _addDeclarationsForEach: function (D, E, A, F) {
        var C = E.objectForKey(D), B;
        A.setObjectForKey(C, C._name, true);
        this._ownedComponentsIds[this._ownedComponentsIds.length] = D;
        B = C.typeClass();
        if (!B || (B && !B.isLoaded())) {
            F.addObject(C._type)
        }
    }, addDeclarations: function (A) {
        if (A) {
            A.forEach(this._addDeclarationsForEach, this, A, this.declarations(), this.declarationTypesToLoad())
        }
    }, loadDeclarationTypesIfNeeded: function () {
        var A = this.declarationTypesToLoad().allObjects(), B, C = -1, E, D;
        if (A && A.length > 0) {
            B = [];
            while ((E = A[++C])) {
                if (NSImport.importNamed(E).isLoaded()) {
                    continue
                } B.addObject(E)
            } if (B && (B.length > 0)) {
                D = NSImport.importNamed(this.qualifiedClassName());
                window.defaultCenter.addObserver(this, "newTemplateImportLoaded", "load", D);
                D.addImports(B, this)
            } else {
                this.setIsTemplateImportsLoaded(true)
            } delete this._declarationTypesToLoad
        } else {
            this.setIsTemplateImportsLoaded(true)
        }
    }, postProcessTemplateForEachDeclaration: function (C, D, A) {
        var B = D.objectForKey(C);
        this.postProcessTemplateForDeclaration(B, A)
    }, postProcessTemplateForDeclaration: function (C, E) {
        var H = C.nodeAccessFunction(E), A = C.typeClass(), G = A.prototype, I, F, B, D = 0;
        I = G.willCreateComponentWithDeclarationElement(C, H);
        if (I !== H) {
            I.id = H.id;
            I.className = H.className;
            if (I.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                if (I.childNodes.length === 1) {
                    H.parentNode.replaceChild(I, H)
                } else {
                    range = H.ownerDocument.createRange();
                    range.selectNode(H);
                    range.deleteContents();
                    range.insertNode(I);
                    range.detach()
                }
            } else {
                H.parentNode.replaceChild(I, H)
            }
        } if ((F = C.childDeclarations())) {
            while ((B = F[D++])) {
                this.postProcessTemplateForDeclaration(B, H)
            }
        }
    }, postProcessTemplate: function () {
        var A = this.hierarchicalMapping();
        if (A) {
            A.forEach(this.postProcessTemplateForEachDeclaration, this, A, this.constructor._template)
        }
    }, newTemplateImportLoaded: function (A) {
        this.setIsTemplateImportsLoaded(true)
    }, setIsTemplateLoaded: function (A) {
        if (A) {
            this.constructor._templateLoadingState = 1;
            this.postProcessTemplate();
            window.defaultQueue.enqueueNotification_postingStyle_coalesceMask_forModes_((new Gianduia.Foundation.NSNotification).initWithNameObjectUserInfoContext("templateLoad", this.constructor, null), NSPostASAP, NSNotificationNoCoalescing, null)
        } return this
    }, isTemplateLoaded: function () {
        return (this.constructor._templateLoadingState === 1)
    }, setIsTemplateHTMLLoaded: function (A) {
        this.constructor._isTemplateHTMLLoaded = A;
        if (this.isTemplateDeclarationsLoaded() && this.isTemplateImportsLoaded()) {
            this.setIsTemplateLoaded(true)
        } return this
    }, isTemplateHTMLLoaded: function () {
        return this.constructor._isTemplateHTMLLoaded
    }, setIsTemplateDeclarationsLoaded: function (A) {
        this.constructor._templateDeclarationsLoadingState = 1;
        if (A && this.isTemplateHTMLLoaded() && this.isTemplateImportsLoaded()) {
            this.setIsTemplateLoaded(true)
        } return this
    }, isTemplateDeclarationsLoaded: function () {
        return (this.constructor._templateDeclarationsLoadingState === 1)
    }, setIsTemplateLoading: function (A) {
        this.constructor._templateLoadingState = 0
    }, isTemplateLoading: function () {
        return (this.constructor._templateLoadingState === 0)
    }, _declarationScriptType: "text/declaration", javascriptLanguageValueRegExp: new RegExp("javascript", "i"), processScriptsFromDocument: function (H) {
        var N = window.document, B, I = this._declarationScriptType, K = Element.prototype.hasAttribute, E = -1, L = null, J, A, D, M, G, C = 0, F = null;
        H = (H) ? H : N;
        B = H.getElementsByTagName("script");
        while ((L = B[++E])) {
            J = L.getAttribute("type");
            A = null;
            if (J === I) {
                this.addDeclarations(Gianduia.AppKit.NSBindingDeclaration.declarationsFromStringWithController(L.text ? L.text : (L.childNodes[0] ? L.childNodes[0].data : null), null));
                continue
            } if (L.ownerDocument === N) {
                continue
            } D = L.getAttribute("language");
            if (!this.javascriptLanguageValueRegExp.test(D)) {
                continue
            } if ((L.hasAttribute) ? L.hasAttribute("src") : K.apply(L, ["src"])) {
                A = L.getAttribute("src");
                if (!A.hasSuffix("Gianduia.js")) {
                    NSImport(A)
                }
            } else {
                M = L.childNodes;
                G = "";
                C = 0;
                while ((F = M[C++])) {
                    G += F.nodeValue
                } if (G.length > 0) {
                    window.NSEval(G)
                }
            }
        } this.setIsTemplateDeclarationsLoaded(true);
        this.loadDeclarationTypesIfNeeded()
    }, importElementsInHead: function (C) {
        var F = 0, G, D, A, I, E, B = navigator.isIE, H = window.document.getElementsByTagName("head")[0];
        if (!B) {
            E = document.createDocumentFragment()
        } while ((G = C[F++])) {
            if ((D = (G.tagName.toUpperCase() === "LINK"))) {
                A = G.getAttribute("href");
                if (A.indexOf("http") !== 0 && A.indexOf("/") !== 0) {
                    A = this.templateURL().stringByDeletingLastPathComponent().stringByAppendingPathComponent(A)
                } if (A.indexOf(window.location.protocol) === -1 && !A.hasPrefix("/")) {
                    A = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname.stringByDeletingLastPathComponent().stringByAppendingPathComponent(A)
                } if (document.doesOwnLinkWithHref(A)) {
                    continue
                } if (window.document.createStyleSheet !== undefined) {
                    I = window.document.createStyleSheet(A, 1);
                    document.registerLinkWithHref(A)
                } else {
                    if (G.ownerDocument !== window.document) {
                        I = window.document.importNode(G, true)
                    } else {
                        I = G
                    } I.href = A;
                    document.registerLink(I)
                }
            } if (!B || (B && !D)) {
                E.appendChild(I)
            }
        } if (E && E.firstChild) {
            H.insertBefore(E, H.firstChild);
            delete E
        }
    }, importCssFromXMLDocument: function (B) {
        var A = [];
        A.addObjectsFromArray(B.getElementsByTagName("style"));
        A.addObjectsFromArray(B.getElementsByTagName("link"));
        if (A) {
            this.importElementsInHead(A)
        }
    }, templateHTMLRequestDidFinishLoading: function (F) {
        var D = F.url(), M = window.document, L = F.responseXML().documentElement, I = L, N = null, A = null, G, H, E = 0, B, K = false, J = this._ownedComponentsIds, C;
        if (navigator.isIE) {
            I = L.ownerDocument
        } this.processScriptsFromDocument(I);
        this.importCssFromXMLDocument(I);
        G = I.getElementsByTagName("body")[0];
        if (!G) {
            NSLog("loadTemplateHTMLFromXMLDocument: Couldn't find a body tag in xmlDocument[" + I.toString() + "] at " + D);
            return
        } G.normalize();
        if (this.templateInsertionMode() === this.NSTemplateInsertionModeReplace) {
            if (navigator.isIE) {
                A = Node.prototype.childNodeWithNodeTypeAtIndex.call(G, Node.ELEMENT_NODE, 0)
            } else {
                A = G.childElementAtIndex(0)
            } K = true
        } else {
            A = G
        } if (J && J.length > 0) {
            if ((C = Node.elementsByIds((navigator.isIE) ? L : A, J))) {
                this.buildHierarchicalMapping(A, C)
            }
        } if (K) {
            N = M.importNode(A, true)
        } else {
            H = G.childNodes;
            N = M.createDocumentFragment();
            while ((B = H[E++])) {
                N.appendChild(M.importNode(B, true))
            }
        } this.setTemplateDocumentFragment(N);
        this.setIsTemplateHTMLLoaded(true)
    }, requestDidFailWithError: function (B, A) {
    }, loadTemplateHTML: function (A) {
        if (!A || !(A.length > 0)) {
            return
        } if (this._isRootComponent) {
            this.setTemplateDocumentFragment(document.body);
            this.setIsTemplateHTMLLoaded(true)
        } else {
            if ((this.constructor._templateLoadingState !== 0)) {
                this.setIsTemplateLoading(true);
                var B = Gianduia.Foundation.NSHTTPRequest.request();
                B.setName("templateHTML");
                B.open("GET", A, true, this);
                B.overrideMimeType("text/xml");
                B.send()
            }
        }
    }, loadTemplate: function (A) {
        if (this._isRootComponent || (this.className() != "NSComponent") || (this._templateURL)) {
            this.loadTemplateHTML(this.templateURL())
        } if (this._isRootComponent) {
            this.processScriptsFromDocument()
        }
    }, setOwnerComponent: function (A) {
        this._ownerComponent = A;
        if (this._ownerComponentDeclaration && A) {
            var B = A.setterSelectorForKey(this._ownerComponentDeclaration._name);
            if (typeofA[B] === "function") {
                A[B].call(A, this)
            } if (!this.useSharedInstance()) {
                A.addOwnedComponent(this)
            }
        } return this
    }, _ownerComponent: null, ownerComponent: function () {
        return this._ownerComponent
    }, "static _declarations": null, declarations: function () {
        if (this.constructor._declarations == null) {
            this.constructor._declarations = new Gianduia.Foundation.NSStringKeyDictionary
        } return this.constructor._declarations
    }, willCreateComponentWithDeclarationElement: function (B, A) {
        return A
    }, _buildHierarchicalMappingForEach: function (K, Q, F, J, B, C, A, D) {
        var I = Q.objectForKey(K), N = D[K], G = C + "." + K, P = null, E, M = N, L = true, O, H;
        while (M && (E = M.parentNode) && ((!F && ((E !== A))) || (F && (E.tagName.toUpperCase() != "BODY")))) {
            if (E === A) {
                P = this._ownerComponentDeclaration
            } if (!(O = E.getAttribute("id"))) {
                M = E;
                continue
            } if ((P = Q.objectForKey(O)) === null) {
                if (!(P = B.objectForKey(O))) {
                    M = E;
                    continue
                }
            } if (P) {
                L = false;
                break
            }
        } if (!N) {
            NSLog("Couldn't find DOM element for declaration named " + I.name());
            return
        } if (L) {
            J.setObjectForKey(I, G)
        } if (!I.bindingNamed("elementId")) {
            N.setAttribute("id", G)
        } else {
            G = K
        } I.setQualifiedName(K);
        H = N.className ? N.className : N.getAttribute("class");
        if (H && H.length) {
            I.setElementClasses(H.split(" "))
        } B.setObjectForKey(I, G);
        I.nodeAccessFunction = Node.directAccessFunctionFromParentNodeToChildNode(E, N);
        if (P != null) {
            P.addChildDeclaration(I)
        }
    }, buildHierarchicalMapping: function (B, D) {
        var A = this.declarations(), G, C, F, E;
        if (!A) {
            return
        } G = new Gianduia.Foundation.NSStringKeyDictionary;
        C = new Gianduia.Foundation.NSStringKeyDictionary;
        F = this._isRootComponent;
        E = this.qualifiedClassName();
        if (!B) {
            return
        } A.forEach(this._buildHierarchicalMappingForEach, this, A, F, G, C, E, B, D);
        this.constructor._declarations = C;
        this.constructor._hierarchicalMapping = G
    }, hierarchicalMapping: function () {
        if (!this.constructor._hierarchicalMapping) {
            this.buildHierarchicalMapping(this._element, Node.elementsByIds(this._element, this._ownedComponentsIds))
        } return this.constructor._hierarchicalMapping
    }, "static rootComponent": function () {
        var A = document.rootComponent;
        if (!A) {
            this.initializeRootComponent()
        } return document.rootComponent
    }, _rootComponent: null, rootComponent: function () {
        if (!this._rootComponent) {
            return Gianduia.AppKit.NSComponent.rootComponent()
        } else {
            return this._rootComponent
        }
    }, "static rootComponentQualifiedClassName": function () {
        var A = window.document.body.getAttribute("id");
        return A ? A : "Gianduia.AppKit.NSComponent"
    }, "static initializeRootComponent": function () {
        var A = window.document, B;
        if (!A.rootComponent) {
            B = window.valueForKeyPath(this.rootComponentQualifiedClassName());
            if (typeofB !== "function") {
                B = window.valueForKeyPath("Gianduia.AppKit.NSComponent")
            } this.prototype._rootComponent = new B().initWithOwnerComponentDeclarationParentComponent(null, null, null, null, document.body);
            this.prototype._rootComponent._isRootComponent = true;
            A.rootComponent = this.prototype._rootComponent;
            A.rootComponent.setIsTemplateInserted(true);
            window.defaultCenter.addObserver(this.prototype._rootComponent, "_unload", "unload", window);
            this.detectTracking();
            A.rootComponent.setNeedsDisplay(true);
            window.defaultCenter.postNotificationName("rootComponentSet", document, null)
        }
    }, "static detectTracking": function () {
        var F = document.getElementsByTagName("meta"), B, E;
        for (var C = 0, D; (D = F[C]); C++) {
            if ("tracking_config" === D.getAttribute("name")) {
                B = D.getAttribute("content");
                if (B.length > 0) {
                    window.nsWindow().setTrackingEnabled(true);
                    E = Gianduia.AppKit.NSComponent.rootComponent();
                    E.addNSPropertyNamed(null, "trackingConfig");
                    E.setTrackingConfig(B);
                    var A = NSImport.importNamed("Gianduia.AppKit.NSComponent");
                    A.addImports(["Gianduia.TrackKit.NSTracking"])
                }
            }
        }
    }, _unload: function () {
        var B = this._childComponents, A, C = 0;
        if (B) {
            while ((A = B[C++])) {
                A._unload()
            }
        } this.setElement(null);
        this.unload()
    }, unload: function () {
    }, "static isRootComponentDocumentLoaded": NSProperty({
        defaultValue: false
    }), "static rootComponentDocumentLoaded": function () {
        var A = this.rootComponent();
        window.defaultCenter.removeObserver(Gianduia.AppKit.NSComponent, "rootComponentDocumentLoaded", this.rootComponentQualifiedClassName() + "Load", Gianduia);
        A.display();
        this.setIsRootComponentDocumentLoaded(true);
        A.didLoad();
        window.defaultCenter.postNotificationName("load", A, null)
    }, didLoad: function () {
    }, keyDown: function (A) {
        if (this.performKeyEquivalent(A)) {
            return
        } else {
            this._super("keyDown")(A)
        }
    }, matchesKeyEquivalent: function (B) {
        var I = this.keyEquivalent(), E = typeofI, L = this.keyCodeEquivalent(), M = typeofL, G, K, D, C, J, A, H, F;
        if (E === null || E === undefined || M === null || M === undefined) {
            return false
        } G = B.keyCode();
        K = B.charCode();
        D = B.domEvent().type;
        C = null;
        J = false;
        if ((D === "keypress") && I) {
            C = K;
            if (E === "string") {
                J = (I === String.fromCharCode(C))
            } else {
                if (E === "number") {
                    J = (I === C)
                }
            }
        } else {
            if (D === "keydown") {
                C = G;
                if ((M === "number") && (L === C)) {
                    J = true
                }
            }
        } A = this.keyEquivalentModifier();
        if (!J && !A) {
            return
        } if (A) {
            if (B.getModifierState) {
                if (A && !B.getModifierState(A)) {
                    return
                }
            } else {
                switch (A) {
                    case Event.ctrlKey: if (!B.ctrlKey) {
                            return
                        } else {
                            break
                        } case Event.shiftKey: if (!B.shiftKey) {
                            return
                        } else {
                            break
                        } case Event.altKey: if (!B.altKey) {
                            return
                        } else {
                            break
                        } case Event.optionKey: if (!B.altKey) {
                            return
                        } else {
                            break
                        } case Event.metaKey: if (!B.metaKey) {
                            return
                        } else {
                            break
                        } case Event.commandKey: if (!B.metaKey) {
                            return
                        } else {
                            break
                        } default: return
                }
            }
        } if (!A || (A && ((A === Event.optionKey) || (A === Event.shiftKey)))) {
            H = B.target;
            F = H.tagName;
            if (F) {
                F = F.toLowerCase();
                if (F === "input" || F === "textarea") {
                    return
                }
            }
        } if (J) {
            B.cancel();
            return true
        } return false
    }, keyEquivalent: NSProperty(), keyCodeEquivalent: NSProperty(), _keyEquivalentModifier: null, keyEquivalentModifier: NSProperty(), editable: NSProperty({
        getter: "isEditable", defaultValue: false
    }), _enabled: true, isEnabled: function () {
        return this._enabled
    }, bindToObjectWithKeyPathOptions: function (C, B, D, A) {
        if (C.lowercaseString().hasSuffix("action")) {
            this.setValueForKey(D, C)
        } else {
            if (C === "elementClasses") {
                this.observeElementClassesIfNeeded()
            } else {
                this.superBindToObjectWithKeyPathOptions(C, B, D, A)
            }
        }
    }, acceptsFirstResponder: function () {
        if (this._isRootComponent || (this.isEnabled() && (this.action() || this.doubleAction() || this.mouseEnteredAction() || this.mouseExitedAction()))) {
            return true
        } return false
    }, target: NSProperty({
        getterImplementation: function () {
            return this._target || this.ownerComponent()
        }
    }), action: NSProperty(), doubleAction: NSProperty(), mouseEnteredAction: NSProperty(), mouseExitedAction: NSProperty(), _actionEvent: null, willPerform: NSProperty(), didPerform: NSProperty(), performActionNamed: function (A) {
        var D = this.valueForKey(A), C, B;
        if (D) {
            C = this.target();
            if (D.indexOf(".") !== -1) {
                C = C.valueForKeyPath(D.stringByDeletingLastPathComponent("."));
                D = D.lastPathComponent(".")
            } B = C[D];
            if (BinstanceofFunction) {
                if (this.shouldCancelEventForActionNamed(this._actionEvent, A)) {
                    this._actionEvent.cancel()
                } arguments[0] = this;
                C.setWillPerform(D);
                B.apply(this.target(), arguments);
                C.setDidPerform(D)
            }
        }
    }, performAction: function (B, A) {
        this._actionEvent = B;
        this.performActionNamed(A || this.actionNameForEvent(B));
        this._actionEvent = null
    }, performDoubleAction: function () {
        this.performActionNamed("doubleAction")
    }, actionNameForEvent: function (B) {
        var A = B.type();
        if ((B.NSEventMaskFromType(A) & (B.constructor.MouseMask | B.constructor.MouseDraggedMask)) != 0 && B.clickCount() === 2) {
            return "doubleAction"
        } else {
            if (A === NSEventType.NSMouseEntered) {
                return "mouseEnteredAction"
            } else {
                if (A === NSEventType.NSMouseExited) {
                    return "mouseExitedAction"
                } else {
                    return "action"
                }
            }
        }
    }, shouldCancelEventForActionNamed: function (B, A) {
        if (this._actionEvent && this._actionEvent.isKindOfClass(Gianduia.AppKit.NSEvent)) {
            return true
        } return false
    }, mouseClick: function (A) {
        if (!this.isEnabled()) {
            return
        } this.performAction(A)
    }, mouseEntered: function (A) {
        if (!this.isEnabled()) {
            return
        } this.performAction(A)
    }, mouseExited: function (A) {
        if (!this.isEnabled()) {
            return
        } this.performAction(A)
    }, setEnabled: function (A) {
        this.setElementValueForKey((A ? "true" : "false"), "isenabled");
        this._enabled = A
    }, isHiddenOrHasHiddenAncestor: function () {
        if (this._isRootComponent) {
            return false
        } var B = this._element, C, A, D;
        if (!B) {
            return false
        } while (B && B !== document) {
            if (B.computedStyle) {
                C = B.computedStyle();
                A = (C ? C.getPropertyValue("visibility") : "hidden");
                D = C ? C.getPropertyValue("display") : "none";
                if ((A === "hidden") || (A === "collapse") || (D === "none")) {
                    return true
                }
            } B = B.parentNode
        } return false
    }, performKeyEquivalent: function (D) {
        if (this.matchesKeyEquivalent(D)) {
            this.performKeyEquivalentAction(D)
        } else {
            var B = this.childComponents(), C, A = null;
            if (!B) {
                return false
            } for (C = 0; (A = B[C]); C++) {
                if (!A.isHiddenOrHasHiddenAncestor()) {
                    if (A.performKeyEquivalent(D)) {
                        return true
                    }
                }
            }
        } return false
    }, performKeyEquivalentAction: function (A) {
        this.performAction(A)
    }, __accumulatedDelegateFlagNames: null, "static _delegateFlagNames": ["componentWillDraw", "componentDidDraw"], runtimeStyleSheet: function () {
        if (!this.constructor.prototype._runtimeStyleSheet) {
            var B = document.createCSSStyle(), A = this.constructor.prototype;
            B.title = "NSComponentRuntimeStyleSheet";
            document.getElementsByTagName("head")[0].appendChild(B);
            A._runtimeStyleSheet = B.sheet;
            A.runtimeStyleSheet = function () {
                return this._runtimeStyleSheet
            };
            return A._runtimeStyleSheet
        } return this.constructor.prototype._runtimeStyleSheet
    }, cssStyleRule: function () {
        if (!this._cssStyleRule) {
            this._cssStyleRule = document.addCSSRuleWithSelectorName(("#" + this._elementId), true)
        } return this._cssStyleRule
    }, hitTest: function (A) {
        return A._targetComponent
    }, disableTextSelection: function () {
        var A = this._element;
        if (A) {
            if (typeofA.onselectstart != "undefined") {
                A.onselectstart = function () {
                    return false
                }
            } else {
                if (typeofA.style.MozUserSelect != "undefined") {
                    A.style.MozUserSelect = "none"
                } else {
                    if (typeofA.style.OUserSelect != "undefined") {
                        A.style.OUserSelect = "none"
                    } else {
                    }
                }
            }
        }
    }, focus: function () {
        if (window._nsWindow.firstResponder() != this) {
            window._nsWindow.makeFirstResponder(this)
        } else {
            if (this._element.respondsToSelector !== undefined && this._element.respondsToSelector("focus")) {
                this._element.focus()
            }
        }
    }, debugs: ["intervalRepetitionC"], debug: function (A, B) {
        if (this.debugs.contains(((this.ownerComponentDeclaration()) ? this.ownerComponentDeclaration()._name : ""))) {
            NSLog(this.toString() + " - " + A);
            if (B) {
            } return true
        } return false
    }, toString: function () {
        return this._super("toString")() + " - " + ((this.ownerComponentDeclaration()) ? this.ownerComponentDeclaration()._name : "")
    }
})
})();
